package com.study.common.mybatis.dialect;

public class OracleSqlDialect extends Dialect {
	public boolean supportsLimitOffset() {
		return true;
	}

	public boolean supportsLimit() {
		return true;
	}
	@Override
	public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) {
		if (offset > 0) {
			sql ="select * from(select t.*,rownum rn from(" +sql+") t where rownum<="+(offset+limit)+") where rn> "+offsetPlaceholder;
		} else {
			sql ="select t.*,rownum rn from(" +sql+") t where rownum<="+limitPlaceholder;
		}
		return sql;
	}

}
